package com.smart.speaker.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.CompletableFuture;

@Service
@Slf4j
public class TestService {

    @Async
    public CompletableFuture<String> test1() throws InterruptedException {
        log.info(Thread.currentThread().getName());
        Thread.sleep(2000);
        return CompletableFuture.completedFuture("test");
    }

    @Async
    public CompletableFuture<String> test2() throws InterruptedException {
        log.info(Thread.currentThread().getName());
        Thread.sleep(3000);
        return CompletableFuture.completedFuture("test");
    }
}
